﻿using Mt.Site.Core.Base.BlobStoring;
using System.Collections.Generic;
using System.IO;

namespace Mt.Site.Application.FileFinder
{
    public class DefaultMultipartUploadHelper : IMultipartUploadHelper
    {
        private List<string> PartFiles;

        public string CacheDirectoryPath { get; private set; }
        public string NewFileName { get; private set; }

        public DefaultMultipartUploadHelper(List<string> partFiles, string cacheDirectoryPath, string newFileName)
        {
            PartFiles = partFiles;
            CacheDirectoryPath = cacheDirectoryPath;
            NewFileName = newFileName;
        }
        public int PartCount => PartFiles.Count;

        public Stream OpenReadStream(int index)
        {
            return File.Open(PartFiles[index], FileMode.Open, FileAccess.Read);
        }
    }
}
